/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package RoomPanel.MatchRoom;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Timer;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.mail.*;

/**
 *
 *
 *
 *
 * @author ivanhing
 */
public class MatchStart extends HttpServlet {

    public void time(int mins){
    Timer timer = new Timer();
    }
     
    
    /**
     * 
     * Processes requests for both HTTP
     * <code>GET</code> and
     * <code>POST</code> methods.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        try {
            /*
             * TODO output your page here. You may use following sample code.
             */
            out.println("<html>");
out.println("<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"zh-TW\" lang=\"zh-TW\">");
out.println("<head>");
out.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />");
out.println("    <body>");
out.println("        <a>Remaining Time:</a><form name=\"counter\"><input type=\"text\" size=\"8\" name=\"d2\" value=\"Rest\"></form>");
out.println("        <style type=\"text/css\">");
out.println("        </style>");
out.println("        <a>Please check the match result later</a> ");
out.println("<script> ");
out.println("<!-- ");
out.println(" var milisec=0 ");
out.println(" var seconds=600 ");
out.println(" document.counter.d2.value=\'600\'");
out.println("function display(){ ");
out.println(" if (milisec<=0){ ");
out.println("    milisec=9 ");
out.println("    seconds-=1 ");
out.println(" }  if (seconds<=-1){ ");
out.println("    milisec=0 ");
out.println("    seconds+=1 ");
out.println(" } ");
out.println(" else ");
out.println("    milisec-=1 ");
out.println("    document.counter.d2.value=seconds+'.'+milisec ");
out.println("    setTimeout(\"display()\",100) ");
out.println("} ");
out.println("display() ");
out.println("--> ");
out.println("</script> ");

out.println("<script type=\"text/javascript\" language=\"javascript\">");
out.println("var count=0;");
out.println(" var content=\""+ 
        "文字直播！<br>"+ 
        "[0-0]		比賽開始<br>00:28<br>"+ 
        "[0-0]		AAA後場擲界外球。<br>00:40<br>[0-0]		AAA後場擲界外球。<br>00:56<br>"+ 
        "[0-0]		BBB前場擲界外球。<br>02:23<br>[0-0]		CCC前場擲界外球。<br>02:40<br>"+ 
        "[0-0]		CCC前場擲界外球。<br>04:06<br>[0-0]		DDD用左腳開出內旋弧線角球，EEE將球攔住。<br>05:55<br>"+ 
        "[0-0]		FFF後場擲界外球 。<br>06:36<br>[0-0]		GGG犯規受罰,對方球隊獲得任意球。HHH出任意球,比賽重新進行。<br>07:25<br>"+ 
        "[0-0]		AAA後場擲界外球 。<br>08:19<br>[0-0]		AAA從左邊線踢出角球，BBB解圍。<br>10:08<br>"+ 
        "[0-0]		DDD對CCC犯規 。EEE從本方半場左腳開出直接任意球，展開攻勢。<br>12:23<br>[0-0]		EEE開出長距離球門球 。<br>"+ 
        "13:17<br>[0-0]		GGG前場擲界外球。<br>17:20<br>[0-0]		GGG對DDD犯規受罰,對方球隊獲得任意球。BBB開出任意球。<br>"+ 
        "18:06<br>[0-0]		EEE開出長距離球門球 。<br>18:11<br>[0-0]		EEE對BBB犯規受罰,對方獲任意球。EEE開出任意球。<br>"+ 
        "18:30<br>[0-0]		GGG從禁區外射門,球跑往球門右偏出。<br>18:43<br>[0-0]		EEE開出長距離球門球 。<br>"+ 
        "19:08<br>[0-0]		GGG對CCC犯規 。EEE從本方半場右腳開出直接任意球，展開攻勢。<br>20:42<br>[0-0]		EEE開出長距離球門球 。<br>"+ 
        "21:54<br>[0-0]		FFF後場擲界外球 。<br>23:09<br>[0-0]		AAA從禁區外射門,球飛高越過橫梁。<br>"+ 
        "24:07<br>[0-0]		AAA右腳開出角球，EEE解圍。GGG從小禁區內射門,球從球門中下方進了。 1-0 。DDD攻進球。<br>"+ 
        "26:50<br>[1-0]		GGG後場擲界外球 。<br>27:58<br>[1-0]		AAA從禁區內近距離射門,球擊中球門柱。BBB開出外旋弧線角球。<br>"+ 
        "29:02<br>[1-0]		AAA後場擲界外球 。<br>29:27<br>[1-0]		AAA從禁區內射門,球毫無威脅性的越過球門。<br>"+ 
        "30:01<br>[1-0]		HHH對EEE犯規受罰,對方獲任意球。AAA橫傳任意球，EEE將球攔住。<br>30:58<br>[1-0]		CCC後場擲界外球。"+ 
        "31:36<br>[1-0]		BBB後場擲界外球。<br>32:42<br>[1-0]		AAA前場擲界外球。<br>"+ 
        "33:41<br>[1-0]		CCC前場擲界外球。<br>33:54<br>[1-0]		被AAA橫截，AAA射門。被EEE輕易守住。<br>"+ 
        "36:02<br>[1-0]		BBB射門。EEE將球攔住。<br>36:28<br>[1-0]		AAA前場擲界外球。<br>"+ 
        "37:45<br>[1-0]		HHH因為AAA對其犯規獲得任意球。BBB開出任意球。<br>39:11<br>[1-0]		AAA對DDD犯規受罰,對方球隊獲踢任意球。AAA踢出直接任意球。<br>"+ 
        "40:26<br>[1-0]		CCC對GGG犯規受罰,對方獲得任意球。BBB踢出直接任意球。<br>41:03<br>[1-0]		EEE開出長距離球門球 。<br>"+ 
        "42:45<br>[1-0]		FFF前場擲界外球。<br>42:50<br>[1-0]		CCC前場擲界外球。<br>"+ 
        "44:59<br>[1-0]		EEE開出長距離球門球 。<br>[1-0]	 上半場結束<br>"+ 
        "45:01<br>[1-0]		GGG尼從右邊線右腳開出近前點角球。<br>45:26<br>[1-0]		BBB右腳開出外旋弧線角球，GGG從禁區內頭球攻門,球偏右了。<br>"+ 
        "46:48<br>[1-0]		BBB開出開出內旋弧線角，球被BBB攔下。BBB開出角球，BBB解圍。<br>47:48<br>[1-0]		AAA前場擲界外球。<br>"+ 
        "48:10<br>[1-0]		EEE開出長距離球門球 。<br>49:25<br>[1-0]		GGG前場擲界外球。<br>"+ 
        "49:43<br>[1-0]		GGG尼從右路20碼處右腳射球，偏向右側了。EEE開出長距離球門球 。<br>50:30<br>[1-0]		GGG手球犯規。BBB開出任意球,比賽重新進行。<br>"+ 
        "50:46<br>[1-0]		GGG尼對EEE犯規受罰,對方獲得任意球。HHH出任意球。<br>51:52<br>[2-0]		BBB從禁區內射門,球從球門右上角進了。 2-0 。GGG助攻進球。<br>"+ 
        "53:06<br>[2-0]		GGG後場擲界外球 。<br>54:00<br>[2-0]		AAA前場擲界外球。<br>"+ 
        "54:44<br>[2-0]		BBB射門。EEE解圍。<br>55:11<br>[2-1]		AAA從禁區內射門,球從球門右下角進了。 2-1 。<br>"+ 
        "57:24<br>[2-1]		AAA後場擲界外球 。<br>58:13<br>[2-1]		GGG尼從左路30碼處右腳射球，球越過了橫梁。EEE開出長距離球門球 。<br>"+ 
        "59:44<br>[2-1]		BBB後場擲界外球 。<br>59:56<br>[2-1]		AAA因為CCC對其犯規獲得任意球。GGG開出任意球,比賽重新進行。<br>"+ 
        "62:27<br>[2-1]		AAA替換DDD。<br>64:33<br>[2-1]		BBB從禁區外右腳射門,球毫無威脅性的越過橫梁。<br>"+ 
        "64:52<br>[2-1]		AAA射門。EEE將球攔住。<br>65:01<br>[2-1]		HHH對BBB犯規，裁判判定任意球。HHH開出直接任意球。<br>"+ 
        "66:14<br>[2-1]		BBB對BBB犯規，獲得任意球。BBB開出直接任意球。<br>67:04<br>[2-1]		AAA對AAA犯規，裁判判定任意球。BBB開出任意球。<br>"+ 
        "68:00<br>[2-1]		BBB對AAA犯規，獲得任意球。HHH出任意球。BBB被罰黃牌。<br>69:31<br>[2-1]		GGG對CCC犯規受罰,對方獲任意球。EEE開出直接任意球。<br>"+ 
        "69:39<br>[2-1]		BBB對BBB犯規受罰,對方球隊獲踢任意球。BBB開出任意球。<br>69:45<br>[2-1]		EEE對AAA犯規，獲得任意球。AAA開出任意球。<br>"+ 
        "75:20<br>[2-1]		助理裁判判定AAA越位犯規。EEE踢出直接任意球。<br>76:35<br>[2-1]		AAA被罰手球,給出一個任意球機會。EEE開出直接任意球。AAA被出示黃牌。AAA對EEE犯規受罰,對方獲得任意球。BBB開出任意球,比賽重新進行。<br>"+ 
        "78:06<br>[2-1]		AAA前場擲界外球。<br>78:46<br>[2-1]		EEE手球犯規 。EEE從本方半場右腳開出直接任意球，展開攻勢。<br>"+ 
        "80:19<br>[2-1]		EEE對HHH犯規受罰,對方獲任意球。EEE惡意犯規被記黃牌。AAA開出任意球。<br>82:29<br>[2-1]		BBB因為AAA對其犯規獲得任意球。EEE開出任意球。<br>"+ 
        "83:09<br>[2-1]		AAA前場擲界外球。<br>83:52<br>[2-1]		HHH前場擲界外球。<br>"+ 
        "87:56<br>[2-1]		FFF後場擲界外球 。<br>88:18<br>[2-1]		CCC後場擲界外球 。<br>"+ 
        "88:48<br>[2-1]		EEE開出長距離球門球 。<br>89:11<br>[2-1]		GGG尼手球犯規 。BBB從本方半場左腳開出直接任意球，展開攻勢。<br>"+ 
        "90:00<br>[2-1]		完場<br>"+ 
        "[2-1]	比賽結束<br>"+ 
        "\";");
out.println("function type_write(){");
out.println("if(count<=content.length){document.getElementById(\'reply_comment\').innerHTML=content.substring(0,count);");
out.println("  count++;");
out.println("setTimeout(\"type_write()\",70);}}");
out.println("</script></head>");
out.println("<body onload=\"type_write()\"><div id=\"reply_comment\"></div>");
out.println("</body>");
out.println("</html>");
        } finally {            
            out.close();
        }
    }

    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
    /**
     * Handles the HTTP
     * <code>GET</code> method.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    /**
     * Handles the HTTP
     * <code>POST</code> method.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    /**
     * Returns a short description of the servlet.
     *
     * @return a String containing servlet description
     */
    @Override
    public String getServletInfo() {
        return "Short description";
    }// </editor-fold>
}
